function [Znames,posInStates]=extractObsNames(ZZ,stanames) 
Znames=cell(size(ZZ,1),1);
posInStates=zeros(length(Znames),1); 
for ii=1:length(Znames)
    temp      =find(ZZ(ii,:)~=0 ) ;
    if length(temp) > 1
        error('Need 1 entry only for each row of ZZ')
    end
    Znames(ii)=stanames( temp );
    posInStates(ii)=temp; 
end
